#ifndef __PGPLOT_RENDERER_H
#define __PGPLOT_RENDERER_H

#include <iostream>
#include <string>

#include "Renderer.h"
#include "DataContainer.h"
#include "PGPLOT_cmap.h"

#define DEFAULT_DEV "/xs"

using namespace std;

class PGPLOT_Renderer : public Renderer{

	public: 

	// the functions
        // Unfortunately these have to replicate the functionality of the PGPLOT library
	
	void set_device(char *); // set the pgplot device
	void set_window(float x1, float x2, float y1, float y2);
	void set_limits(float min,float max);

	void set_labels(string title,string xlabel,string ylabel);

	int draw_frame();
	int init();
	int draw_pixels(DataContainer *);
	int build_image(DataContainer *,unsigned long,unsigned long, vector<float>&);
	void draw_point(float, float, int);

        void set_numlevels(int numlevs);
	

	PGPLOT_cmap *ColourMap;
 
	PGPLOT_Renderer();
	~PGPLOT_Renderer();
			
	private:
	void draw_pixel(vector<float>& vertices, float value);
	void oplot_healpix_bounds(int nside,vector<float>& vertices, float value); // this needs to be moved if it works
	// the window 
	float xmin;
	float xmax;
	float ymin;
	float ymax;
	
	char *device;

	// the axes
	string title;
	string xlabel;
	string ylabel;

	string x_options;
	string y_options;

	// the number of colour(bw) levels

	float low_limit;
	float hi_limit;
	int num_levels;
	void set_gray_levels();


};	
#endif
